﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using Microsoft.Phone.Tasks;

namespace NapThe
{
    public partial class KhongDuXu : UserControl
    {
        public static string preAccount = "";
        public static string currentAccount = "";
        Grid MainLayoutRoot;
        NapXu napxu;
        //naptheDienThoai = new NapTheDienThoai(MainLayoutRoot,this);
        public KhongDuXu(Grid MainLayoutRoot , NapXu napxu)
        {
            InitializeComponent();
            this.MainLayoutRoot = MainLayoutRoot;
            this.MainLayoutRoot.Children.Add(this);

            this.napxu = napxu;
        }
 
        private void DownClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {

            TextBlock t = (TextBlock)sender;
            //button14.Style = (Style)this.Resources["BGStyle4"];
            setResource(t.Name, "BGStyle4", "BGStyle3");
            //setResource(t.Name, "BGStyle4", "BGStyle3");

            
        }
        private void UpClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            //button14.Style = (Style)this.Resources["BGStyle3"];
            TextBlock t = (TextBlock)sender;
            setResource(t.Name, "BGStyle3", "BGStyle3");
            processPression(t.Name);
            //NavigationService.Navigate(new Uri("/GamePage.xaml", UriKind.RelativeOrAbsolute));
        }
        public void setResource(string name, string source1, string source2)
        {
            if (!source1.Equals(source2))
            {
                resetResource(name, source2);
            }
            if (textBlock24.Name.Equals(name))
            {
                button12.Style = (Style)this.Resources[source1];
                return;
            }
            if (textBlock25.Name.Equals(name))
            {
                button13.Style = (Style)this.Resources[source1];
                return;
            }
            if (textBlock26.Name.Equals(name))
            {
                button14.Style = (Style)this.Resources[source1];
                return;
            }

        }

        public void resetResource(string name, string source)
        {
            if (!textBlock24.Name.Equals(name))
            {
                button12.Style = (Style)this.Resources[source];
            }
            if (!textBlock25.Name.Equals(name))
            {
                button13.Style = (Style)this.Resources[source];
            }
            if (!textBlock26.Name.Equals(name))
            {
                button14.Style = (Style)this.Resources[source];
            }

        }
        public void processPression(string name)
        {
            if (textBlock24.Name.Equals(name))
            {
                this.Visibility = Visibility.Collapsed;
                napxu.NapXuSms();
               // napxu.naptheDienThoai.radioButton3.IsChecked = true;
               // napxu.naptheDienThoai.OnVisible();
                return;
            }
            if (textBlock25.Name.Equals(name))
            {
                this.Visibility = Visibility.Collapsed;
                napxu.khacScreen.OnVisible();
                return;
            }
            if (textBlock26.Name.Equals(name))
            {
                this.Visibility = Visibility.Collapsed;
                return;
            }
        }
    }
}
